package com.doit.day01.op

object _01_元组 {
  def main(args: Array[String]): Unit = {
    //name,age,id,gender  ==>定义一个对象来封装这一系列得数据
    //元组==》本身是一个类
    val tuple: (String, Int, Double) = new Tuple3("zss", 18, 18.8)//第一种方式

    //第二种方式
    val tuple1: (Int, Double, String, Char, Boolean) = (1, 1.8, "str", 'a', true)


    //获取到元组里面得元素
    val id: Int = tuple1._1
    val d: Double = tuple1._2
    val name: String = tuple1._3

    println(id+","+d+","+name)


    //需要将  id，name,age,gender 封装起来，然后有很多用户，放在一个集合里面

    val tuples: List[(Int, String, Int, String)] = List((1, "zss", 18, "gender"), (2, "lss", 29, "female"), (3, "ww", 67, "male"))
    for (elem <- tuples) {
      val id: Int = elem._1
      val name: String = elem._2
      val age: Int = elem._3
      val gender: String = elem._4
      println(id+","+age+","+name+","+gender)
    }



  }

}
